/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Metodos;

import Atributos.at_tela;
import BD.CriaConexao;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

/**
 *
 * @author ARMTEC
 */
public class tela {
    
    private Connection conexao;

    public tela() throws SQLException, ClassNotFoundException {
        this.conexao = (Connection) CriaConexao.getConexao();

    }
    public void altera(at_tela a) throws SQLException {
        String sql = " update tela set id_tela=?";
        PreparedStatement stmt = (PreparedStatement) conexao.prepareStatement(sql);
        
        stmt.setInt(1, a.getNumero());
        stmt.execute();
        stmt.close();
    }
    
    public void buscar() throws SQLException{
        at_tela a1=new at_tela();
        String sql = "select id_tela from tela";
        PreparedStatement stmt = (PreparedStatement) conexao.prepareStatement(sql);
        ResultSet rs2 = (ResultSet) stmt.executeQuery();
        while (rs2.next()) {
        a1.setNumero(rs2.getInt("id_tela")); 
        }
        rs2.close();
       
       stmt.close();
    }
}
